package com.x.sys.controller;

import java.util.Arrays;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.x.common.bo.JsonResult;
import com.x.common.bo.PageObject;
import com.x.sys.entity.SysItem;
import com.x.sys.service.SysItemService;

@RestController
@RequestMapping("/item/")
public class SysItemController {
	@Autowired
	private SysItemService sysItemService;
	@RequestMapping("doDeleteObjects")
	//@ResponseBody
	
	public JsonResult doDeleteObjects(Integer...ids) {
		System.out.println(Arrays.toString(ids));
		//调用业务层方法执行删除业务
		sysItemService.deleteObjects(ids);
		return new JsonResult("删除成功!");
	}
		@RequestMapping("doFindPageObjects")
		public JsonResult doFindPageObject(String name,Integer pageCurrent) {
			PageObject<SysItem> pageObject=
					sysItemService.findPageObjects(name,pageCurrent);
			return new JsonResult(pageObject);
		}
		@RequestMapping("doSaveObject")
		  @ResponseBody
		  public JsonResult doSaveObject(SysItem entity){
		   sysItemService.saveObject(entity);
		  return new JsonResult("save ok");    
		  }
}
